package com.jeesite.modules.em;

import lombok.Getter;

/**
 * 商家任务状态
 */
@Getter
public enum MyTaskStatus {
    //用户任务状态0进行中 1待审核 2已通过  3未通过 4纠纷 5结束
    JINXINGZHONG("0","进行中"),
    DAISHENHE("1","待审核"),
    YITONGGUO("2","已通过"),
    WEITONGGUO("3","未通过"),
    JIUFEN("4","纠纷"),
    JIESHU("5","结束"),
    CHAOSHIWEITIJIAO("99","超时未提交"),//自动结束
    ;

    private MyTaskStatus(String code, String message) {
        this.code = code;
        this.message = message;
    }

    private final String code;

    private final String message;

    //遍历枚举V1
    public static MyTaskStatus getTaskStatusEnum(String code)
    {
        for (MyTaskStatus element : MyTaskStatus.values()) {
            if(element.getCode().equalsIgnoreCase(code))
            {
                return element;
            }
        }
        return null;
    }

    //遍历枚举V2
    public static String getTaskStatusSecond(String code)
    {
        for (MyTaskStatus element : MyTaskStatus.values()) {
            if(element.getCode().equalsIgnoreCase(code))
            {
                return element.getMessage();
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return getCode();
    }

}

